package com.hiyee.cart.mapper;

import com.hiyee.api.mapper.MyMapper;
import com.hiyee.pojo.Cart;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

@Repository
public interface CartMapper extends MyMapper<Cart> {
    /**
     * 查询客户ID及商铺ID查询购物车
     *
     * @param Long customerId
     * @return Integer
     */
    public Cart getByCustomerId(@Param("customer_id")Long customerId);

    /**
     * 根据购物车 id 查询购物车
     *
     * @param Long cartId
     * @return Cart
     */
    public Cart getById(@Param("cart_id")Long cartId);

    /**
     * 更新购物车总金额和总数量
     *
     * @param BigDecimal totalAmount
     * @param Integer qty
     * @return Integer
     */
    public Integer updateTotal(@Param("cart_id")Long cartId, @Param("total_amount")BigDecimal totalAmount, @Param("qty")Integer qty);
}